package com.lw;

import java.awt.*;

/**
 * 敌方鱼
 */
public class Enemy {

    Image img;

    int x,y;//坐标

    int width,height;//物体宽高

    int speed;//移动速度

    int dir = 1;//方向：面朝左-1，面朝右1
    public static final int DIR_LEFT = -1;
    public static final int DIR_RIGHT = 1;


    int type;//类型

    int score;// 分值

    public void paintSelf(Graphics g){
        g.drawImage(img,x,y,width,height,null);
    }

    /**
     * 绘制矩形用于碰撞检测
     * @return
     */
    public Rectangle getRec(){
        return new Rectangle(x,y,width,height);
    }
}

/**
 * 敌方鱼面朝左
 */
class Enemy_1_L extends Enemy{
    public Enemy_1_L() {
        this.x = GameWin.WIDTH+60;
        this.y = (int)(Math.random()*700+100);
        this.img = GameUtils.enemy1_img;
        this.width = 60;
        this.height = 40;
        this.speed = 10;
        this.score = 1;
        this.type = 1;
        this.dir = -1;
    }
}

/**
 * 敌方鱼面朝右
 */
class Enemy_1_R extends Enemy{
    public Enemy_1_R() {
        this.x = -60;
        this.y = (int)(Math.random()*700+100);
        this.img = GameUtils.enemyr_img;
        this.width = 60;
        this.height = 40;
        this.speed = 10;
        this.score = 1;
        this.type = 1;
    }
}

class Enemy_2_L extends Enemy{
    Enemy_2_L(){
        this.x = GameWin.WIDTH+100;
        this.y = (int)(Math.random()*700+100);
        this.img = GameUtils.enemyl_2img;
        this.width = 100;
        this.height = 100;
        this.speed = 5;
        this.score = 2;
        this.type = 2;
        this.dir = -1;
    }
}

class Enemy_2_R extends Enemy{
    public Enemy_2_R() {
        this.x = -100;
        this.y = (int)(Math.random()*700+100);
        this.img = GameUtils.enemyr_2img;
        this.width = 100;
        this.height = 100;
        this.speed = 5;
        this.score = 2;
        this.type = 2;
    }
}


class Enemy_3_L extends Enemy{
    Enemy_3_L(){
        this.x = GameWin.WIDTH+100;
        this.y = (int)(Math.random()*700+100);
        this.img = GameUtils.enemyl_3img;
        this.width = 100;
        this.height = 100;
        this.speed = 20;
        this.score = 3;
        this.type = 3;
        this.dir = -1;
    }
}

class Enemy_3_R extends Enemy{
    public Enemy_3_R() {
        this.x = -100;
        this.y = (int)(Math.random()*700+100);
        this.img = GameUtils.enemyr_3img;
        this.width = 100;
        this.height = 100;
        this.speed = 20;
        this.score = 3;
        this.type = 3;
    }
}

class Enemy_Boss extends Enemy{
    public Enemy_Boss() {
        this.x = -1000;
        this.y = (int)(Math.random()*700+100);
        this.img = GameUtils.bossImg;
        this.width = 340;
        this.height = 100;
        this.speed = 100;
        this.score = 0;
        this.type = 10;
    }
}

